'use strict';
var dbcApp = angular.module('dbcApp', ['ngAnimate', 'ngSanitize'])

/** 定义全局配置 */
.config(['$httpProvider', '$controllerProvider', function($httpProvider, $controllerProvider) {
	$httpProvider.defaults.headers.common.Accept = 'application/json, text/html, text/plain, * / *';
	$httpProvider.defaults.headers.post = {'Content-Type' : 'application/x-www-form-urlencoded'};
	$controllerProvider.allowGlobals();
}])

/** 定义全局控制器 */
.controller('basicCtrl', ['$scope', '$http', function($scope, $http) {
	angular.extend($scope, {
		// 判断数据是否为空
		// 数据未定义或数组长度为零判为空
		empty: function(data) {
			if (angular.isUndefined(data) || data === null) return true;
			if (angular.isArray(data) && data.length === 0) return true;
			return false;
		}
	});
}]);
